#ifndef MSG_AD_H
#define MSG_AD_H

/*************************************************************************
 *
 * Module:	MSG_AD.H
 *
 * Purpose:	Messages between Arbitrator and Market Distributor
 *
 *
 * Dependencies: 
 *
 * Author:	xxx
 *
 * Modification History (latest first):
 * Rv	Date	  By		Reason for change
 * ---  --------  -----------   ---------------------------------------------
 * 06   6/23/95   EB            Ansi-ize
 * 05   6/14/94   EB            Remove MKTHITPROCESSED message
 * 04   2/22/94   Ed Howorka    Small EBS Deals Enhancement.
 *                              Add MKTHITPROCESSED2.
 * 03   4/18/93   E. Barasch    Add synch info to MDRqst and MDAck messages
 * 02 	10/15/92  E.Howorka   	changed MKTQTEDONE,MKTQTEAMTRESERVED,
 *				MKTQTEAMTUNRESERVED,MKTQTEINTERRUPTED,
 *				MKTHITPROCESSED,MKTQTEAVAILABLE messages
 * 01	xx/xx/xx  xxx		Initial creation.
 *************************************************************************/
#include "ebs_defn.h"

/*******************************************************************************
                          MESSAGE DEFINES FOLLOW:
*******************************************************************************/
/*  */
/*
   NAME :AD_ChkMktCreditData
   DESC :This message contains a reduced representation ("checksum") of the
         part of the global yes/no credit martix needed by the Market
         Distributor. It is used to validate the corresponding data held by
         the MD.
*/
typedef struct _CHKMKTCREDITDATA   *PCHKMKTCREDITDATA;          /* pcmcd */
typedef struct _CHKMKTCREDITDATA                                /*  cmcd */
        {
           MSGHDREBS           mhebs;
           FXLONG              lCreditChk;
        }CHKMKTCREDITDATA;


/*
   NAME :DA_ChkMktCreditDataAck
   DESC :This message is sent in response to AD_ChkMktCreditData.
*/
typedef struct _CHKMKTCREDITDATAACK  *PCHKMKTCREDITDATAACK;     /* pcmcda */
typedef struct _CHKMKTCREDITDATAACK                             /*  cmcda */
        {
           MSGHDREBS           mhebs;
           FXBOOL              fChkOk;
        }CHKMKTCREDITDATAACK;

/*
   NAME :AD_ChkMktQteData
   DESC :This message contains a reduced representation ("checksum") of the
         Arbitrator's set of all EBS quotes for the specified currency pair.
         It is used to validate the corresponding data held by the Market
         Distributor.
*/
typedef struct _CHKMKTQTEDATA  *PCHKMKTQTEDATA;                 /* pcmqd */
typedef struct _CHKMKTQTEDATA                                   /*  cmqd */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXLONG              lQteChk;
        }CHKMKTQTEDATA;

/*
   NAME :DA_ChkMktQteDataAck
   DESC :This message is sent in response   to AD_ChkMktQteData.
*/
typedef struct _CHKMKTQTEDATAACK  *PCHKMKTQTEDATAACK;           /* pcmqda */
typedef struct _CHKMKTQTEDATAACK                                /*  cmqda */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXBOOL              fChkOk;
        }CHKMKTQTEDATAACK;

/*
   NAME :AD_MktCreditData
   DESC :This message contains a full representation of the part of the
         global yes/no credit martix needed by the Market Distributor.
         It is used to (re)initialize the corresponding data held by the MD.
*/
typedef struct _MKTCREDITDATA  *PMKTCREDITDATA;                 /* pmcd */
typedef struct _MKTCREDITDATA                                   /*  mcd */
        {
           MSGHDREBS           mhebs;
           FXFLRKEY            fk;
           FXBOOL              fMsgFirst;
           FXBOOL              fMsgMore;
           FXBYTE              bItemCnt;
           FXFLRKEY            afkCparty [DIM_MAX_FLR_KEYS];
        }MKTCREDITDATA;


/*
   NAME :AD_MktUpdate
   DESC :This super-message is used to group together a number of smaller
         messages of the following types:

         AD_MktCreditUpdate
         AD_MktHitProcessed2
         AD_MktQteAmtReserved
         AD_MktQteAmtUnreserved
         AD_MktQteAmtAvailable
         AD_MktQteDone
         AD_MktQteInterrupted
*/

typedef struct _MKTUPDATE  *PMKTUPDATE;                            /* pmu */
typedef struct _MKTUPDATE                                          /*  mu */
        {
           MSGHDREBS           	mhebs;
           FXBYTE            	bItemCnt;
           FXUSHORT		usDataSize;
           FXCHAR		achMktUpdateData [DIM_MKTUPDATEDATA];
        }MKTUPDATE;


/*
   NAME :AD_MktCreditUpdate
   DESC :This message specifies that a credit floor grants (or revokes) credit
         to a number of other trading floors.
*/
typedef struct _MKTCREDITUPDATE  *PMKTCREDITUPDATE;             /* pmcu  */
typedef struct _MKTCREDITUPDATE                                 /*  mcu  */
        {
           MSGHDREBS           mhebs;
           FXFLRKEY            fk;
           FXBOOL              fCreditOk;
           FXBOOL              fMsgMore;
           FXBYTE              bItemCnt;
           FXFLRKEY            afkCparty [DIM_MAX_FLR_KEYS];
        }MKTCREDITUPDATE;

/*
   NAME :AD_MktHitProcessed2
   DESC :This message announces that a new buy/sell request has been
         successfully matched with an existing quote or quotes and is being
         processed.
*/
typedef struct _MKTHITPROCESSED2 *PMKTHITPROCESSED2;            /* pmhebsp */
typedef struct _MKTHITPROCESSED2                                /*  mhebsp */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bHitType;
           FXPRICE             prcHit;
           FXBASEAMT           baHitAmtDealt;
        } MKTHITPROCESSED2;


/*
   NAME :AD_MktQteAmtReserved
   DESC :This message announces that a specified amount of a quote is no longer
         available because the quote or a part of it has been  selected by an
         Arbitrator to participate in a deal.  The receiving Market Distributor
         should reduce the available amount of the  quote.
*/
typedef struct _MKTQTEAMTRESERVED  *PMKTQTEAMTRESERVED;         /* pmqar */
typedef struct _MKTQTEAMTRESERVED                               /*  mqar */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXBASEAMT           baDealAmt;
           EBSTRANSID          etiQteId; 
        }MKTQTEAMTRESERVED;


/*
   NAME :AD_MktQteAmtUnreserved
   DESC :This message announces that a specified amount of a quote is  once
         again available because the deal which caused it to be reserved could
         not be completed or was completed for a smaller amount (usually
         because of credit limits being exceeded). The receiving Market
         Distributor should increment the available amount of the quote.
*/
typedef struct _MKTQTEAMTUNRESERVED  *PMKTQTEAMTUNRESERVED;     /* pmqau */
typedef struct _MKTQTEAMTUNRESERVED                             /*  mqau */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXBASEAMT           baDealAmt;
           EBSTRANSID          etiQteId; 
        }MKTQTEAMTUNRESERVED;


/*
   NAME :AD_MktQteAvailable
   DESC :This message announces the availability of a new quote.  The receiving
         Market Distributor should create an entry for the quote in its Active
         Bids and/or Active Offers lists.
*/
typedef struct _MKTQTEAVAILABLE  *PMKTQTEAVAILABLE;             /* pmqa */
typedef struct _MKTQTEAVAILABLE                                 /*  mqa */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXFLRKEY            fkMaker;
           EBSTRANSID          etiQteId; 
           FXPRICE             prcQte;
           FXBASEAMT           baQteAmt;
           FXBASEAMT           baQteAmtAvail;
        }MKTQTEAVAILABLE;


/*
   NAME :AD_MktQteAvailable2
   DESC :This message announces the availability of a new quote.  The receiving
         Market Distributor should create an entry for the quote in its Active
         Bids and/or Active Offers lists.
*/
typedef struct _MKTQTEAVAILABLE2  *PMKTQTEAVAILABLE2;           /* pmqa */
typedef struct _MKTQTEAVAILABLE2                                /*  mqa */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXFLRKEY            fkMaker;
           EBSTRANSID          etiQteId; 
           FXPRICE             prcQte;
           FXBASEAMT           baQteAmt;
           FXBASEAMT           baQteAmtAvail;
           FXFLRKEY            fkMakerPB;
        }MKTQTEAVAILABLE2;


/*
   NAME :AD_MktQteDone
   DESC :This message announces that the specified quote is being permanently
         removed from market because a deal or a number of deals were completed
         against the quote.  The Market Distributor should delete the quote
         record.
*/
typedef struct _MKTQTEDONE  *PMKTQTEDONE;                       /* pmqdo */
typedef struct _MKTQTEDONE                                      /*  mqdo */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
        }MKTQTEDONE;


/*
    NAME :AD_MktQteInterrupted
    DESC :This message announces that the quote has been interrupted.
          The Market Distributor should delete the quote
*/
typedef struct _MKTQTEINTERRUPTED  *PMKTQTEINTERRUPTED;         /* pmqi */
typedef struct _MKTQTEINTERRUPTED                               /*  mqi */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
        }MKTQTEINTERRUPTED;
/*  */


/*
    NAME :AD_MktQteData
    DESC :This message contains a full of the Arbitrator's set of all EBS
          quotes for the specified currency pair.  It is used to (re)initialize
          the corresponding data held by the Market Distributor.
*/
typedef struct _MKTQTEDATA  *PMKTQTEDATA;                /* pmqd */
typedef struct _MKTQTEDATA                               /*  mqd */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXBOOL              fMsgFirst;
           FXBOOL              fMsgMore;
           FXBYTE              bItemCnt;
           MKTQTEINFO          amqif [DIM_MKTQTE_INFO];
        }MKTQTEDATA;


/*
    NAME :AD_MktQteData2
    DESC :This message contains a full of the Arbitrator's set of all EBS
          quotes for the specified currency pair.  It is used to (re)initialize
          the corresponding data held by the Market Distributor.
*/
typedef struct _MKTQTEDATA2  *PMKTQTEDATA2;              /* pmqd */
typedef struct _MKTQTEDATA2                              /*  mqd */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           FXBOOL              fMsgFirst;
           FXBOOL              fMsgMore;
           FXBYTE              bItemCnt;
           MKTQTEINFO2         amqif [DIM_MKTQTE_INFO];
        }MKTQTEDATA2;


/*
    NAME :DA_StartupMDRqst
    DESC :Sent during startup by a Market Distributor signing on to its
          Arbitrator.
*/
typedef struct _STARTUPMDRQST  *PSTARTUPMDRQST;                 /* psmdr */
typedef struct _STARTUPMDRQST                                   /*  smdr */
        {
           MSGHDREBS    mhebs;
           FXTIMESTAMP  tsPairsFile;
           FXTIMESTAMP  tsNodesFile;
        }STARTUPMDRQST;


/*
   NAME :AD_StartupMDAck
   DESC :Sent in response to DA_StartupMDRqst.
*/
typedef struct _STARTUPMDACK  *PSTARTUPMDACK;                   /* psmda */
typedef struct _STARTUPMDACK                                    /*  smda */
        {
           MSGHDREBS     mhebs;
           FXBYTE        bStartupStatus;
           FXULONG       ulReasonCode;            /* application specific reason code */
        }STARTUPMDACK;
#endif
